#include <bits/stdc++.h>
using namespace std;

int main(){
    int n; cin >> n;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        // 偶数行
        if(i % 2 == 0){
            for(int j = i*n+1; j <= n*(i+1); ++j){
                cout << j;
                cnt++;
                if(cnt % n == 0) cout << '\n';
                else cout << " ";
            }
        }else{
            for(int j = (i+1)*n; j > n*i; --j){
                cout << j;
                cnt++;
                if(cnt % n == 0) cout << '\n';
                else cout << " ";
            }
        }
    }
    return 0;
}
/*
偶数行 j=i*n+1  j<=i*n+n  ++j
奇数行 j= (i+1)*n  j > (i+1)*n-n --j
0    1   2   3   4
1    8   7   6   5
2    9   10  11  12
3    16  15  14  13
*/